package org.me.bean;

import org.ksoap2.serialization.SoapObject;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

public class Student implements Parcelable {

	private String studentId;
	private String studentName;
	private String schoolName;
	private String password;

	public static final String Log_Tag = "CourseSchedule";

	public Student() {
	}

	public Student(SoapObject obj) {
		super();

		try {
			
			this.studentId = obj.getPropertyAsString("studentId");
			this.studentName = obj.getPropertyAsString("studentName");
			this.schoolName = obj.getPropertyAsString("schoolName");
			this.password = obj.getPropertyAsString("password");

		} catch (Exception e) {
			Log.e(Log_Tag, "parse soap obj exception", e);
		}

	}

	public String getStudentId() {
		return studentId;
	}

	public void setStudentId(String studentId) {
		this.studentId = studentId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getStudentName() {
		return studentName;
	}

	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	public String getSchoolName() {
		return schoolName;
	}

	public void setSchoolName(String schoolName) {
		this.schoolName = schoolName;
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(studentId);
		dest.writeString(studentName);
		dest.writeString(schoolName);
		dest.writeString(password);

	}

	private void readFromParcel(Parcel in) {
		studentId = in.readString();
		studentName = in.readString();
		schoolName = in.readString();
		password = in.readString();
		Log.d(Log_Tag, "put back data");
	}

	public static final Parcelable.Creator<Student> CREATOR = new Parcelable.Creator<Student>() {
		public Student createFromParcel(Parcel in) {
			return new Student(in);
		}

		public Student[] newArray(int size) {
			return new Student[size];
		}
	};

	public Student(Parcel in) {
		readFromParcel(in);
	}

}
